<?php
	session_start();
	mysql_connect("localhost", "sapmenet_admin", "a1s2d3f4g5h6j7") or die ("Problem with datebase");
	mysql_select_db("sapmenet_users");
	$text = $_POST['text'];
	$text=htmlspecialchars($text);
	$text=mysql_real_escape_string($text);
	//emoticons
		$text=str_replace("(axe)", "<img src=chatIcons/axe.gif>", "$text");
		$text=str_replace("(baby)", "<img src=chatIcons/baby.gif>", "$text");
		$text=str_replace("(bananadance)", "<img src=chatIcons/bananadance.gif>", "$text");
		$text=str_replace("(band)", "<img src=chatIcons/band.gif>", "$text");
		$text=str_replace("(bash)", "<img src=chatIcons/bash.gif>", "$text");
		$text=str_replace("(beer)", "<img src=chatIcons/beer.gif>", "$text");
		$text=str_replace("(blink)", "<img src=chatIcons/blink.gif>", "$text");
		$text=str_replace("(fitnes)", "<img src=chatIcons/body-builder2.gif>", "$text");
		$text=str_replace("(bounce)", "<img src=chatIcons/bounce.gif>", "$text");
		$text=str_replace("(bow)", "<img src=chatIcons/bow.gif>", "$text");
		$text=str_replace("(boxing)", "<img src=chatIcons/boxing.gif>", "$text");
		$text=str_replace("(weed)", "<img src=chatIcons/cannabis.gif>", "$text");
		$text=str_replace("(chair)", "<img src=chatIcons/chair.gif>", "$text");
		$text=str_replace("(clap)", "<img src=chatIcons/clap.gif>", "$text");
		$text=str_replace("(clap2)", "<img src=chatIcons/clap2.gif>", "$text");
		$text=str_replace("(cry)", "<img src=chatIcons/cry1.gif>", "$text");
		$text=str_replace("(devil)", "<img src=chatIcons/devil.gif>", "$text");
		$text=str_replace("(eat)", "<img src=chatIcons/eat.gif>", "$text");
		$text=str_replace("(fishing)", "<img src=chatIcons/fishing.gif>", "$text");
		$text=str_replace("(flood)", "<img src=chatIcons/flood.gif>", "$text");
		$text=str_replace("(good)", "<img src=chatIcons/good.gif>", "$text");
		$text=str_replace("(guns)", "<img src=chatIcons/guns.gif>", "$text");
		$text=str_replace("(happy)", "<img src=chatIcons/happy.gif>", "$text");
		$text=str_replace("(hpb)", "<img src=chatIcons/hpb.gif>", "$text");
		$text=str_replace("(hmm)", "<img src=chatIcons/hmmm.gif>", "$text");
		$text=str_replace("(fuck)", "<img src=chatIcons/humb.gif>", "$text");
		$text=str_replace("(icecream)", "<img src=chatIcons/icecream.gif>", "$text");
		$text=str_replace("(inlove)", "<img src=chatIcons/in_love.gif>", "$text");
		$text=str_replace(":D", "<img src=chatIcons/laugh.gif>", "$text");
		$text=str_replace(":d", "<img src=chatIcons/laugh.gif>", "$text");
		$text=str_replace(";D", "<img src=chatIcons/laugh.gif>", "$text");
		$text=str_replace(";d", "<img src=chatIcons/laugh.gif>", "$text");
		$text=str_replace("(sleep)", "<img src=chatIcons/lazy2.gif>", "$text");
		$text=str_replace("(ihaa)", "<img src=chatIcons/mbounce.gif>", "$text");
		$text=str_replace("(super)", "<img src=chatIcons/mml.gif>", "$text");
		$text=str_replace("(bg)", "<img src=chatIcons/more_bg.gif>", "$text");
		$text=str_replace("(music)", "<img src=chatIcons/music.gif>", "$text");
		$text=str_replace("(no)", "<img src=chatIcons/no1.gif>", "$text");
		$text=str_replace("(pepsi)", "<img src=chatIcons/pepsi.gif>", "$text");
		$text=str_replace(":@", "<img src=chatIcons/rant.gif>", "$text");
		$text=str_replace("(haa)", "<img src=chatIcons/ras.gif>", "$text");
		$text=str_replace("(rip)", "<img src=chatIcons/rip.gif>", "$text");
		$text=str_replace("(rofl)", "<img src=chatIcons/rofl.gif>", "$text");
		$text=str_replace("(slap)", "<img src=chatIcons/slap.gif>", "$text");
		$text=str_replace("(snap)", "<img src=chatIcons/snap.gif>", "$text");
		$text=str_replace("(sorry)", "<img src=chatIcons/sorry.gif>", "$text");
		$text=str_replace("(spank)", "<img src=chatIcons/spank.gif>", "$text");
		$text=str_replace("(stako)", "<img src=chatIcons/stretcher.gif>", "$text");
		$text=str_replace("(joro)", "<img src=chatIcons/strongbench.gif>", "$text");
		$text=str_replace("(pesho)", "<img src=chatIcons/super.gif>", "$text");
		$text=str_replace(":P", "<img src=chatIcons/ppp.gif>", "$text");
		$text=str_replace(";p", "<img src=chatIcons/ppp.gif>", "$text");
		$text=str_replace(";P", "<img src=chatIcons/ppp.gif>", "$text");
		$text=str_replace(":p", "<img src=chatIcons/ppp.gif>", "$text");
		$text=str_replace("(tease)", "<img src=chatIcons/tease.gif>", "$text");
		$text=str_replace(":Ppp", "<img src=chatIcons/tease1.gif>", "$text");
		$text=str_replace("(luck)", "<img src=chatIcons/thumbsup.gif>", "$text");
		$text=str_replace("(tisho)", "<img src=chatIcons/viking.gif>", "$text");
		$text=str_replace("(wow)", "<img src=chatIcons/w00t.gif>", "$text");
		$text=str_replace("(idiot)", "<img src=chatIcons/wall.gif>", "$text");
		$text=str_replace("(hi)", "<img src=chatIcons/wave.gif>", "$text");
		$text=str_replace("byee", "<img src=chatIcons/wavecry.gif>", "$text");
		$text=str_replace("(yahoo)", "<img src=chatIcons/yahoo.gif>", "$text");
		$text=str_replace("(yes)", "<img src=chatIcons/yes.gif>", "$text");
		$text=str_replace("(goodnight)", "<img src=chatIcons/goodnight.gif>", "$text");
		$text=str_replace("(bath)", "<img src=chatIcons/bath.gif>", "$text");
	//end of emoticons
	$to = $_POST['to'];
	$me = $_SESSION['JID'];
	$executable = mysql_query("INSERT INTO `chat`(`from`, `to`, `message`) VALUES ({$me}, {$to}, '".$text."')");
?>

















































































































































































































































































































































































































































































































































































































